package spark.example

import scala.collection.mutable.ArrayBuffer
import Array._
object arraybufferTest {
  def main(args: Array[String]): Unit = {
    val arrayBuffer = ArrayBuffer[Any]()
    arrayBuffer += ("baidu",1)
    arrayBuffer += ("ali",2)
    arrayBuffer += ("qq",3)
    println(arrayBuffer)
  val arrayOfDim = ofDim[Int](2,3)
    for ( x <- 0 to 1) {
      for (y <- 0 to 2) {
        arrayOfDim(x)(y) = y
      }
    }
    println("Array OfDim")
    for (x <- 0 to 1) {
      for (y <- 0 to 2) {
        print(" " + arrayOfDim(x)(y))
      }
      println()
    }

    println("ArrayBuffer OfDim")
    val arrayBufferOfDim = arrayOfDim.toBuffer
    arrayBufferOfDim += Array(2,3,4)
    // println("arrayBufferOfDim: " + arrayBufferOfDim)
   /* for (x <- 0 to 2) {
      for (y <- 0 to 2) {
        print(" " + arrayBufferOfDim(x)(y))
      }
      println()
    }*/
  }

}
